package Dinamica.src;

import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileReader;
import java.security.acl.LastOwnerException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class pacial_robbery {

	static class info {
		public int c1;
		public int f1;
		public int c2;
		public int f2;

		public info(int c1, int f1, int f2, int c2) {
			this.c1 = c1;
			this.c2 = c2;
			this.f1 = f1;
			this.f2 = f2;
		}

		public String toString() {
			return " f1 " + f1 + " c1 " + c1 + " f2 " + f2 + " c2 " + c2 ;
		}
	}

	public static void llenar(int[][] memo, info in) {
		
		//System.out.println(in);
		//System.out.println("antes");
		//imprimir(memo);
		for (int i = in.f1; i <= in.f2; i++) {
			for (int j = in.c1; j <= in.c2; j++) {
				//if ((i == in.f1 || i == in.f2 || j == in.c1 || j == in.c2)
				//		&& memo[i][j] != 1) {
				//	memo[i][j] = 2;
				//} else {
					memo[i][j] = 1;
				//}
			}
		}
		//System.out.println("despues");
		//imprimir(memo);
		//System.out.println();

	}

	public static void imprimir(int memo[][]){
		for (int i = 0; i < memo.length; i++) {
			System.out.println(Arrays.toString(memo[i]));
		}
	}
	
	public static List<int[]> disponibles(int memo[][]) {
		List<int[]> l = new ArrayList<int[]>(100);
		for (int i = 1; i < memo.length; i++) {
			for (int j = 1; j < memo[i].length; j++) {
				if (memo[i][j] == 0) {
					l.add(new int[] { i, j });
				}
				//if (memo[i][j] == 2) {
				//	memo[i][j] = 0;
				//}
			}
		}
		
		
		for (int i = 0; i < memo.length; i++) {
			for (int j = 0; j < memo.length; j++) {
				if(memo[i][j]==0){
					if(i+1<memo.length)memo[i+1][j]=2;
					if(j+1<memo[0].length)memo[i][j+1]=2;
					if(i-1>=0)memo[i-1][j]=2;
					if(j-1>=0)memo[i][j-1]=2;
				}
			}
		}
		
		for (int i = 0; i < memo.length; i++) {
			for (int j = 0; j < memo.length; j++) {
				if(memo[i][j]==2)memo[i][j]=0;
			}
		}
		
		
		return l;

	}

	public static int dis(int[] a, int[] b) {
		return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]);
	}

	public static void main(String[] args) throws Throwable {
		BufferedReader br = new BufferedReader(new FileReader("robbery.in"));
		String line = null;
		int caso=1;
		while ((line = br.readLine()) != null) {
			//System.out.println(caso++);
			StringTokenizer st = new StringTokenizer(line);
			int f = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			int t = Integer.parseInt(st.nextToken());
			if (c == 0 && f == 0 && t == 0)
				break;
			if(caso>1)
			System.out.println();

			int n = Integer.parseInt(br.readLine());

			List<info> informes[] = new List[t + 1];
			for (int i = 1; i < informes.length; i++) {
				informes[i] = new ArrayList<info>(100);
			}

			for (int i = 0; i < n; i++) {
				String u = br.readLine();
				st = new StringTokenizer(u);
				int tem = Integer.parseInt(st.nextToken());
				List<info> l = informes[tem];
				//left
				int c1=Integer.parseInt(st.nextToken());
				//top
				int f1=Integer.parseInt(st.nextToken());
				//rigth
				int c2=Integer.parseInt(st.nextToken());
				//button
				int f2=Integer.parseInt(st.nextToken());
				l.add(new info(c1, f1, f2 ,c2));
			}
			// System.out.println(l);
			int memo[][] = new int[f + 1][c + 1];

			List<int[]> posibles[] = new List[t + 1];

			for (int i = 1; i < posibles.length; i++) {
				posibles[i] = new ArrayList<int[]>();
			}

			boolean seVolo = false;

			// Para t=1
			List<info> t1 = informes[1];
			for (info it : t1) {
				llenar(memo, it);
			}
			posibles[1] = disponibles(memo);
			// para t>1
			for (int i = 2; i < posibles.length; i++) {
//				System.out.println("tiempo = "+i);
				
				List<info> tem = informes[i];
				if (tem.size() != 0) {
					for (info it : tem) {
						llenar(memo, it);

					}
				}
				posibles[i] = disponibles(memo);
				
			}
			

			int lastTime = 1;
			for (int i = 2; i < posibles.length; i++) {
				List<int[]> tem1 = posibles[i - 1];
				List<int[]> tem2 = posibles[i];
				
				if (tem2.size() > 0) {
					int deltaT = i - lastTime;
					List<int[]> res = new ArrayList<int[]>(100);
					for (int[] it2 : tem2) {
						for (int[] it1 : tem1) {
							if (dis(it2, it1) <= deltaT) {
								res.add(it2);
								break;
							}
						}
					}
					posibles[i] = res;
					lastTime = i;

				}

			}
			
			
			/*
			System.out.println("estructura intermedia");

			for (int i = 1; i < posibles.length; i++) {
				System.out.println("en el tiempo t = " + i + " :");
				// if(posibles[i]!=null)
				for (int[] it : posibles[i]) {
					System.out.println(Arrays.toString(it));
				}

			}
			*/
			
			lastTime = posibles.length-1;
			for (int i = posibles.length - 2 ; i >= 1; i--) {
				List<int[]> tem1 = posibles[i + 1];
				List<int[]> tem2 = posibles[i];
				if (tem2.size() > 0) {
					int deltaT = Math.abs( i - lastTime );
					List<int[]> res = new ArrayList<int[]>(100);
					for (int[] it2 : tem2) {
						for (int[] it1 : tem1) {
							if (dis(it2, it1) <= deltaT) {
								res.add(it2);
								break;
							}
						}
					}
					posibles[i] = res;
					lastTime = i;
					
				}

			}

			
			
			
			
			
			// imprimir estrutura
			/*

			System.out.println("estructura final");

			for (int i = 1; i < posibles.length; i++) {
				System.out.println("en el tiempo t = " + i + " :");
				// if(posibles[i]!=null)
				for (int[] it : posibles[i]) {
					System.out.println(Arrays.toString(it));
				}

			}
			 */
			// System.out.println(posibles[1]);
			
			System.out.println("Robbery #"+caso+":");
			caso++;
			for (int i = 1; i < posibles.length; i++) {
				if(posibles[i].size()==0)seVolo=true;
			}			
			
			
			if(seVolo){
				System.out.println("The robber has escaped.");
				continue;
			}
			
			boolean nothing=true;
			for (int i = 1; i < posibles.length; i++) {
				if(posibles[i].size()==1){
					int [] tem=posibles[i].get(0);
					System.out.println("Time step "+1+": The robber has been at "+tem[1]+","+tem[0]+".");
					nothing=false;
				}
			}
			if(nothing){
				System.out.println("Nothing known.");
			}
			

		}
	}
}
